<template>
  <div>
      <aplayer autoplay :music="{
          title: musicList[0].songname,
          src: $axios.defaults.baseURL +  musicList[0].url, }"
               :list="musicList">
      </aplayer>

  </div>
</template>

<script>
import aplayer from "vue-aplayer";

export default {
  name: "",
  components: {
    aplayer
  },
  data() {
    return {
      musicList: []
    };
  },
  computed: {},
  created() {
    // this.getMusicList();
    this.$axios.get('/api/user/list', {headers: {TOKEN: localStorage.getItem('TOKEN')}}).then(res => {
      console.log(res.data.data[0].musicList)
      if (res.data.data != null && res.data.data.length > 0) {
        this.musicList = [];
        for (let i =0;i<res.data.data[0].musicList.length;i++) {
          this.musicList.push({
            title:  res.data.data[0].musicList[i].songname,
            src:  this.$axios.defaults.baseURL + res.data.data[0].musicList[i].url,
          })
        }
      }

    })
  },

};
</script>

<style lang="scss" scoped type="text/css">
</style>

